package com.adou.d14;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapTest3 {
    public static void main(String[] args) {
        Map<String, Double> map = new HashMap<>();
        map.put("蜘蛛精", 162.5);
        map.put("蜘蛛精", 169.5);
        map.put("紫霞", 165.8);
        map.put("至尊宝", 161.8);
        map.put("牛魔王", 185.8);
        System.out.println(map);

        // 1.通过map全部key
        Set<String> keys = map.keySet();
        System.out.println(keys);
        for (String key : keys) {
            Double height = map.get(key);
            System.out.println(key+"  //-  "+height);
        }

        System.out.println("//////////////////////////////");
        // entry.getkey()
        Set<Map.Entry<String, Double>> entries = map.entrySet();
        for (Map.Entry<String, Double> entry : entries) {
            String key = entry.getKey();
            Double value = entry.getValue();
            System.out.println(key + "==========" + value);
        }


        System.out.println("//////////////BiConsumer////////////////");
        map.forEach((key, value)->{
            System.out.println(key + "====== Lambda  ======" + value);
        });

    }
}
